<!DOCTYPE html>
<html>
	<head>
		<title>TODO supply a title</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style type="text/css">

	html, body, div, span, object, iframe,
	h1, h2, h3, h4, h5, h6, p, blockquote, pre,
	abbr, address, cite, code,
	del, dfn, em, img, ins, kbd, q, samp,
	small, strong, sub, sup, var,
	b, i,
	dl, dt, dd, ol, ul, li,
	fieldset, form, label, legend,
	table, caption, tbody, tfoot, thead, tr, th, td {
		margin:0;
		padding:0;
		border:0;
		outline:0;
		font-size:100%;
		vertical-align:baseline;
		background:transparent;
	}
	
	body {
		margin:0;
		padding:0;
		font:12px/15px "Helvetica Neue",Arial, Helvetica, sans-serif;
		color: #555;
		background:#f5f5f5;
	}
	
	a {color:#666;}
	
	#content {width:65%; max-width:690px; margin:6% auto 0;}
	
	/*
	Pretty Table Styling
	CSS Tricks also has a nice writeup: http://css-tricks.com/feature-table-design/
	*/
	
	table {
		overflow:hidden;
		border:1px solid #d3d3d3;
		background:#fefefe;
		width:100%;
		margin:5% auto 0;
		-moz-border-radius:5px; /* FF1+ */
		-webkit-border-radius:5px; /* Saf3-4 */
		border-radius:5px;
		-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
		-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
	}
	
	th, td {padding:18px 28px 18px; text-align:center; }
	
	th {padding-top:22px; text-shadow: 1px 1px 1px #fff; background:#e8eaeb;}
	
	td {border-top:1px solid #e0e0e0; border-right:1px solid #e0e0e0;}
	
	tr.odd-row td {background:#f6f6f6;}
	
	td.first, th.first {text-align:left}
	
	td.last {border-right:none;}
	
	/*
	Background gradients are completely unnecessary but a neat effect.
	*/
	
	td {
		background: -moz-linear-gradient(100% 25% 90deg, #fefefe, #f9f9f9);
		background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f9f9f9), to(#fefefe));
	}
	
	tr.odd-row td {
		background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
		background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
	}
	
	th {
		background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
		background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
	}
	
	/*
	I know this is annoying, but we need additional styling so webkit will recognize rounded corners on background elements.
	Nice write up of this issue: http://www.onenaught.com/posts/266/css-inner-elements-breaking-border-radius
	
	And, since we've applied the background colors to td/th element because of IE, Gecko browsers also need it.
	*/
	
	tr:first-child th.first {
		-moz-border-radius-topleft:5px;
		-webkit-border-top-left-radius:5px; /* Saf3-4 */
	}
	
	tr:first-child th.last {
		-moz-border-radius-topright:5px;
		-webkit-border-top-right-radius:5px; /* Saf3-4 */
	}
	
	tr:last-child td.first {
		-moz-border-radius-bottomleft:5px;
		-webkit-border-bottom-left-radius:5px; /* Saf3-4 */
	}
	
	tr:last-child td.last {
		-moz-border-radius-bottomright:5px;
		-webkit-border-bottom-right-radius:5px; /* Saf3-4 */
	}

</style>
	<script type="text/javascript" src="http://o2o.gtimg.com/module/jquery.js" ></script>
	<script type="text/javascript">
 $(function() {
		/* For zebra striping */
        $("table tr:nth-child(odd)").addClass("odd-row");
		/* For cell text alignment */
		$("table td:first-child, table th:first-child").addClass("first");
		/* For removing the last border */
		$("table td:last-child, table th:last-child").addClass("last");
});
</script>

	</head>
	<body>
		<script>
		
			var openid='';
			function MCS_ClientNotify(EventData) {
//				test(EventData);
				EventData = strToJson(EventData);
				switch(EventData['event']){
					case 'OnUserChange':{
						OnUserChange(EventData);
						break;
					}
					case 'OnMapMsgClick':{
						OnMapMsgClick(EventData);
						break;
					}
				}
			}
			function strToJson(str){
				var json = (new Function("return " + str))();
				return json;
			}
			
			function OnUserChange(data){
				openid=data.useraccount;
				$(".openid").val(openid)
                                
                                //获得客服数据
                                {if !$_SESSION['kefu'] }
                                ajaxGetKefu(openid);
                                {/if}
                                setInterval("ajaxRefreshWorker()",60000)
                                
				var url="{php echo $this->createMobileUrl('ajaxGetMember')}";
				var data={
					"openid":openid
				}
				var callback=function(data){
//					test(data);
					$.each(data.member,function(key,val){
						$("."+key).html(val);
						$("."+key).val(val);
					})
				}
				var type="json";
				$.post(url,data,callback,type)
				
			}
			
			
			
			function test(content){
				$("#test").html(content)
			}
			function edit(){
				$(".show").hide();
				$(".edit").show();
			}
		</script>
<!--			<div id="test">
				测试
		</div>-->
		<div id="area"></div>
		<div>
			<table class="show">
				{loop $column $key=>$value}
				<tr>
					<td>{$value[column_show_name]}</td>
					<td><span class="{$value[column_name]}"></span></td>
					<td></td>
				</tr>
				{/loop}
				
			</table>
			<form method="post" action="{php echo $this->createMobileUrl('editMember')}">
				<input type="hidden" value="" name="openid" class="openid" />
				<input type="hidden" value="" name="uid" class="uid" />
			<table class="edit" style="display: none">
				{loop $column $key=>$value}
				{if $value[is_edit]}
				<tr>
					<td>{$value[column_show_name]}</td>
					<td><input type="text" name="{$value[column_name]}" class="{$value[column_name]}" /></td>
				</tr>
				{/if}
				{/loop}
			</table>
			<input type="submit" value="确认修改" class="edit" style="display: none" />
			</form>
		</div>
		<div>
			<input type="button" value="刷新" onclick="window.location.reload()"/>
			<input type="button" value="修改" onclick="edit()" />
			
		</div>
		
		<div>
				
		</div>		
		
<script>
//获得客服账号			

var workerAccouont = '';

function ajaxRefreshWorker(){
	var url="{php echo $this->createMobileUrl('refreshKefu')}";
	var data={};
	var callback=function(data){
		
	}
	var type="json"
	$.post(url,data,callback,type);
}

function ajaxGetKefu(openid){
    var url="{php echo $this->createMobileUrl('getKefuByOpenid')}";
    var data={
        "openid":openid
    }
    var callback=function(data){
        
    }
    var type="html";
    $.post(url,data,callback,type);
}
</script>
<div id="openid"></div>
<!--<div class="test" id="test">111</div>-->
	</body>
	
</html>
